package com.bff.gaia.runtime.maqy.service;

import java.time.LocalDate;

/**
 * add by HFY.
 * 保存linux环境下读取的网络状态信息，比如/proc/net/dev，或者/proc/[psid]/net/dev。
 */

public class NetStat {
	private final LocalDate timeStamp;

	// Receive
	private long rBytes;
	private long rPackets;
	private long rErrs;
	private long rDrop;

	// Transmit
	private long tBytes;
	private long tPackets;
	private long tErrs;
	private long tDrop;

	// Constructors
	public NetStat(long rBytes, long rPackets, long rErrs, long rDrop, long tBytes, long tPackets, long tErrs, long tDrop) {
		this.timeStamp = LocalDate.now();

		this.rBytes = rBytes;
		this.rPackets = rPackets;
		this.rErrs = rErrs;
		this.rDrop = rDrop;

		this.tBytes = tBytes;
		this.tPackets = tPackets;
		this.tErrs = tErrs;
		this.tDrop = tDrop;
	}

	// Getters
	public long getrBytes() {
		return rBytes;
	}

	public long getrPackets() {
		return rPackets;
	}

	public long getrErrs() {
		return rErrs;
	}

	public long getrDrop() {
		return rDrop;
	}

	public long gettBytes() {
		return tBytes;
	}

	public long gettPackets() {
		return tPackets;
	}

	public long gettErrs() {
		return tErrs;
	}

	public long gettDrop() {
		return tDrop;
	}

	@Override
	public String toString() {
		return String.format("(%s) rBytes-%d, rPackets-%d, rErrs-%d, rDrop-%d, tBytes-%d, tPackets-%d, tErrs-%d, tDrop-%d", timeStamp, rBytes, rPackets, rErrs, rDrop, tBytes, tPackets, tErrs, tDrop);
	}
}